Skip to content

Fix Galvanic Iteration - #6978

Merged
matthewevans merged 4 commits into
phase-rs:mainfrom
JacobWoodson:card/galvanic-iteration
Aug 9, 2026
Merged

Fix Galvanic Iteration#6978
matthewevans merged 4 commits into
phase-rs:mainfrom
JacobWoodson:card/galvanic-iteration

Conversation

@JacobWoodson

@JacobWoodson JacobWoodson commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes a parse-fidelity defect on Galvanic Iteration.

Issue: audit-flagged: SilentDrop — part of the Oracle text is silently dropped from the parsed AST; identify the missing clause and restore it.

Files changed

  • C:\Users\jacob\source\repos\phase-card-runs\crates\engine\src\game\coverage.rs

CR references

  • CR 603.7b
  • CR 707.10
  • CR 707.10c

Track

Developer

LLM

Model: claude-opus-4-8
Thinking: high

Tier: Frontier

Verification

  • cargo fmt --all — clean (exit 0)
  • ./scripts/check-parser-combinators.sh (Gate A) — clean — Gate G PASS + Gate A PASS + Family-D cross-product detector self-test PASS (10/10). Initial run exited 1 ONLY because the broken WindowsApps python3 stub (exit 126) is first on PATH; re-run with the working msys64 python3 (3.9.7) passes fully. Env limitation, not a failure.
  • cargo clippy-strict — clean (exit 0, 0 errors, 0 warnings; finished in 5m08s)
  • cargo test -p phase-engine — FAILED (exit 101): 18467 passed, 1 failed, 6 ignored. Sole failure is environmental (Windows path-separator) in unrelated multiplayer prompt-census infra; unrelated to Galvanic Iteration.
  • cargo export-cards data --stats --sidecar-dir client/public && cp client/public/card-data.json data/card-data.json — clean (EXPORT_EXIT 0, CP_EXIT 0; 333 set files / 28154 cards; data/card-data.json refreshed against this branch's engine)
  • cargo coverage — clean (exit 0); Galvanic Iteration supported:true gap_count:0 (Flashback + CreateDelayedTrigger both supported)
  • cargo semantic-audit — clean (exit 0); 32699 audited, 284 with findings; Galvanic Iteration has 0 findings (absent from data/semantic-audit.json and .md)
  • Chunk-2 re-verification (fresh card-data): Re-verified at chunk-2 checkpoint with fresh card-data: supported:true gap:0, semantic-audit clean. The run-time 'partial' was a Windows census-test artifact (cargo test path-separator bug), not a code defect.

Scope Expansion

None. (Finding reproduced; fix confined to coverage.rs as planned. It correctly cleared the whole spell-copy class — 10 cards — which is intended class coverage, not scope growth.)

Validation Failures

See review/cross-check notes.

CI Failures

  • cargo test -p phase-engine: 1 of 18468 tests failed — game::engine::stage2_injector_tests::the_cr_603_5_prompt_census_is_pinned_so_a_sixth_producer_is_a_counted_event, panic at crates/engine/src/game/engine.rs:15185. ROOT CAUSE: Windows-only path-separator mismatch. The assertion compares computed producer paths (built via Path::display() at engine.rs:15148-15152, which emits '' on Windows) against a hardcoded expected vec using '/' (e.g. "game/effects/mod.rs:5996"). left=["game\effects\mod.rs:5996", ...] vs right=["game/effects/mod.rs:5996", ...] — the five entries AND line numbers are identical; only the separator differs. The separator-independent count asserts ((5,7,25) and total 37) both PASSED. Green on CI/Linux. NOT caused by this run: no source was edited and the pinned line numbers did not drift (fmt was a no-op on those files). NOT modified: the test is very recent multiplayer prompt-census/owner-firewall infra (its own comment explicitly warns 'do NOT edit pins to match a local tree'), so per multi-agent safety it was left untouched. NOT retryable: deterministic assertion. Completely unrelated to Galvanic Iteration. This is the ONLY reason passed=false; every Galvanic-Iteration-specific gate (fmt, parser gate, clippy, coverage supported/gap0, semantic-audit 0 findings) is green.

Summary by CodeRabbit

  • Bug Fixes

    • Improved audit coverage for spell-copy effects, including direct and delayed copy instructions.
    • Copy effects are now recognized across both permanent and spell-copy wording.
    • Added safeguards to continue flagging lines that lack a valid copy effect.
  • Tests

    • Added regression coverage for direct, delayed, nested, and invalid spell-copy scenarios.

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@matthewevans, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 1 minute

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 195d3b66-fa08-4cd9-b5d3-a9a66b99eb17

📥 Commits

Reviewing files that changed from the base of the PR and between cb1484b and 14c6215.

📒 Files selected for processing (1)
  • crates/engine/src/game/coverage.rs
📝 Walkthrough

Walkthrough

The semantic audit now recognizes descriptionless CopySpell effects for permanent and spell-copy wording. Regression tests cover direct copies, delayed copies, and findings when no corresponding effect exists.

Changes

CopySpell semantic-audit coverage

Layer / File(s) Summary
CopySpell matching and regression coverage
crates/engine/src/game/coverage.rs
The CopySpell fallback matches permanent-copy text and spell-copy text such as “copy that spell,” “copy it,” and “copy target …”. Tests cover nested delayed copies, direct copies, and missing-effect cases.

Estimated code review effort: 3 (Moderate) | ~15–30 minutes

Possibly related PRs

Suggested labels: bug

Suggested reviewers: matthewevans

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the primary change, which restores the missing Oracle clause for Galvanic Iteration.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the needs-maintainer AI-contribution PR requires human triage (Non-dev track or unresolved gaps) label Aug 4, 2026
@matthewevans matthewevans self-assigned this Aug 4, 2026
@matthewevans

Copy link
Copy Markdown
Member

Maintainer update pushed at 8fa4e946fd3aa8774d16faa4fe60668cf1f6cd3f: merged current main (cdb99baba1e32ca937af2e86f81a55f86dcbd4fe) cleanly. The merge contains only upstream #6945 changes; this PR's crates/engine/src/game/coverage.rs change did not conflict. Holding approval and queue action until CI and the parse artifact finish for this new head, followed by a fresh current-head scan/review. CodeRabbit is rate-limited, so it is not an external review gate for this pass.

@matthewevans matthewevans added the enhancement New feature or request label Aug 4, 2026
@matthewevans matthewevans removed their assignment Aug 4, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/engine/src/game/coverage.rs`:
- Around line 9391-9403: Split the CR annotation in the coverage classification
comments: cite CR 707.5 for the clone-permanent “enter as a copy of” branch, and
retain CR 707.10 only for spell-copy behavior on the stack. Update the nearby
surface-class descriptions without changing the matching logic.
- Around line 9405-9408: Update the copy-text predicate in
line_matches_effect_type so the “copy target” branch only matches text
explicitly identifying a spell, while preserving the existing “that spell” and
“copy it” handling. Ensure lines describing copied activated abilities do not
match when another ability has Effect::CopySpell, and add a negative regression
covering that case using the full typed CopySpell coverage rules.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 9e404885-c23c-44bd-b473-538ee079bc66

📥 Commits

Reviewing files that changed from the base of the PR and between cdb99ba and 8fa4e94.

📒 Files selected for processing (1)
  • crates/engine/src/game/coverage.rs

Comment thread crates/engine/src/game/coverage.rs
Comment thread crates/engine/src/game/coverage.rs Outdated
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

Generated for head 14c6215d2158d2de0f4c083cd453aaaf29fab33a.

Parse changes introduced by this PR

✓ No card-parse changes detected.

@matthewevans matthewevans self-assigned this Aug 4, 2026

@matthewevans matthewevans left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current head 8fa4e946fd3aa8774d16faa4fe60668cf1f6cd3f has two verified coverage/provenance findings.

[MED] The CopySpell coverage heuristic can hide an unparsed non-spell copy clause behind a different ability. Evidence: crates/engine/src/game/coverage.rs:9405-9408 accepts any copy target, while :9436-9447 searches the whole face for any CopySpell. Why it matters: a face with a valid spell-copy ability can be marked covered even when another ability's copy target <non-spell> line was not parsed. Suggested fix: require a spell-specific source phrase/shape and add a two-ability negative regression (valid spell copy plus unparsed non-spell copy).

[LOW] The enter-as-copy branch cites the wrong rule. Evidence: coverage.rs:9390-9403 describes both enter-as-copy and spell-copy under CR 707.10. Verified rules: docs/MagicCompRules.txt:5629 (CR 707.5) governs entering as a copy; :5666 (CR 707.10) governs copies of spells/abilities. Why it matters: CR citations must accurately identify the implemented rule. Suggested fix: split the comments/citations by the two copy classes.

@matthewevans matthewevans removed their assignment Aug 4, 2026
@JacobWoodson JacobWoodson changed the title Partial: Galvanic Iteration Fix Galvanic Iteration Aug 5, 2026
@matthewevans matthewevans removed the needs-maintainer AI-contribution PR requires human triage (Non-dev track or unresolved gaps) label Aug 6, 2026
@matthewevans matthewevans self-assigned this Aug 9, 2026

@matthewevans matthewevans left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified current head 14c6215: CopySpell coverage now requires spell-specific wording, has a discriminating non-spell-copy regression, and the CR 707.5/707.10 citations are correctly separated. Required CI is green.

@matthewevans
matthewevans added this pull request to the merge queue Aug 9, 2026
Merged via the queue into phase-rs:main with commit 6307c25 Aug 9, 2026
12 checks passed
@JacobWoodson
JacobWoodson deleted the card/galvanic-iteration branch August 10, 2026 01:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants